#include "FLOW_core/flow_core_pch.h"
#include "FLOW_core/DebugLogger.h"
#include "LogMgrTest.h"

//=============================================================================

CLogMgrTest::CLogMgrTest( )
{
}

//=============================================================================

CLogMgrTest::~CLogMgrTest( )
{
}

//=============================================================================

void CLogMgrTest::Test( void )
{
	using namespace CORE;

	const char_t* p_sz_aux = "Log Manager Test";
	u32_t u_aux = 999;

	//Logging before initializing
	LOG( LOG_TYPE_INFO, "LogMgrTest", "Logging after shutdown: %s %d", p_sz_aux, u_aux );

	//Initialize log manager
	bool_t b_ok = LOG_MGR->Initialize( );
	FLOW_ASSERT( b_ok, "Couldn't initialize Log Manager!!" );
	CDebugLogger p_logger;
	LOG_MGR->RegisterLogger( &p_logger );
	LOG( LOG_TYPE_INFO, "LogMgrTest", "This is an info test message: %s %d", p_sz_aux, u_aux );
	LOG( LOG_TYPE_WARNING, "LogMgrTest", "This is a warning test message: %s %d", p_sz_aux, u_aux );
	LOG( LOG_TYPE_ERROR, "LogMgrTest", "This is an error test message: %s %d", p_sz_aux, u_aux );
	LOG( LOG_TYPE_CRITICAL, "LogMgrTest", "This is a critical test message: %s %d", p_sz_aux, u_aux );

	LOG_MGR->UnregisterLogger( &p_logger );

	LOG( LOG_TYPE_INFO, "LogMgrTest", "Logging without loggers: %s %d", p_sz_aux, u_aux );

	b_ok = LOG_MGR->Shutdown( );
	FLOW_ASSERT( b_ok, "Couldn't shutdown the Log Manager!!" );

	LOG( LOG_TYPE_INFO, "LogMgrTest", "Logging after shutdown: %s %d", p_sz_aux, u_aux );
}

//=============================================================================